<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="../include/tag.jsp" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <title>登录事件分析</title>
    <link rel="stylesheet" href="${ctx}/css/common/list.css">
    <link rel="stylesheet" href="${ctx}/css/common/table.css">
    <%@include file="../include/commonFile.jsp" %>

</head>
<body>
<!--头部-->
<%@include file="../include/header.jsp" %>
<div class="index-outside">
    <%@include file="../include/sidebar.jsp" %>
    <!--内容-->
    <section>
        <div class="section-main">
            <div class="layui-tab-item layui-show">
                <div class="layui-tab layui-tab-brief" lay-filter="type">
                    <div class="layui-tab-content">
                        <form class="layui-form" action="${ctx}/analysis/event/list.do" id="myForm" method="post">
                            <input type="hidden" name="pageNo" id="pageNo"/>
                            <input type="hidden" name="type" id="type" value="${se.type}" />
                            <div class="f-search-bar">
                                <div class="search-container">
                                    <ul class="search-form-content">
                                        <li class="form-item"><label class="search-form-lable">机构名称</label>
                                            <div class="layui-input-block">
                                                <input class="layui-input" type="text" name="partnerName"
                                                       value="${input.partnerName}" placeholder="机构名称">
                                            </div>
                                    </ul>
                                    <ul class="search-form-content">
                                        <li class="form-item"><label class="search-form-lable">筛选日期</label>
                                            <div class="check-btn-inner" id="timeType">
                                                <%--<a href="javascript:void(0);"
                                                   onclick="setTimeType($(this),1,'#myForm')" ${input.timeType == 1 ? 'class="active"' : ''}>今天</a>--%>
                                                <a href="javascript:void(0);"
                                                   onclick="setTimeType($(this),2,'#myForm')" ${input.timeType == 2 ? 'class="active"' : ''}>昨天</a>
                                                <a href="javascript:void(0);"
                                                   onclick="setTimeType($(this),3,'#myForm')" ${input.timeType == 3 ? 'class="active"' : ''}>最近7天</a>
                                                <a href="javascript:void(0);"
                                                   onclick="setTimeType($(this),4,'#myForm')" ${input.timeType == 4 ? 'class="active"' : ''}>最近30天</a>
                                                <input type="hidden" name="timeType" value="${input.timeType}"/>
                                            </div>
                                            <div class="layui-inline">
                                                <div class="layui-input-inline">
                                                    <input class="layui-input" type="text" name="createStart"
                                                           value="${input.createStart}" placeholder="开始日">
                                                </div>
                                                -
                                                <div class="layui-input-inline">
                                                    <input class="layui-input" type="text" name="createEnd"
                                                           value="${input.createEnd}" placeholder="截止日">
                                                </div>
                                            </div>
                                        </li>
                                        <li class="form-item-inline">
                                            <div class="sub-btns">
                                                <a class="layui-btn layui-btn-danger"
                                                   href="javascript:submitFunction('#myForm')">查询</a>
                                                <a class="layui-btn layui-btn-normal"
                                                   href="javascript:resetFunction('#myForm')">重置</a>
                                            </div>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </form>
                        <div class="cl">
                            <table class="layui-table layui-form" id="myTable" lay-skin="line">
                                <colgroup>
                                    <col width="100px">
                                    <col width="100px">
                                    <col width="100px">
                                    <col width="100px">
                                    <col width="100px">
                                </colgroup>
                                <thead>
                                <tr>
                                    <th>机构名称</th>
                                    <th>事件名称</th>
                                    <th>事件触发总次数</th>
                                    <th>事件触发总用户数</th>
                                    <th>事件类型</th>
                                </tr>
                                </thead>
                                <tbody>
                                <c:forEach var="event" items="${list}">
                                    <tr>
                                        <td>${event.partnerName} </td>
                                        <td>${event.name} </td>
                                        <td>${empty event.eventNum ? 0 : event.eventNum}</td>
                                        <td>${empty event.onUserEventNum ? 0 : event.onUserEventNum}</td>
                                        <td>
                                            ${event.type == 1 ? '网页端': ''}
                                            ${event.type == 2 ? '移动端': ''}
                                        </td>
                                    </tr>
                                </c:forEach>
                                </tbody>
                            </table>
                        </div>
                        <div id="page_content" class="page-container"></div>
                    </div>
                </div>
            </div>
        </div>
        <!--底部-->
        <%@include file="../include/footer.jsp" %>
    </section>
</div>

<script type="text/javascript" src="${ctx}/script/common/list.js"></script>
<script type="text/javascript" src="${ctx}/script/common/table_option.js"></script>
<script type="text/javascript">
    $(function () {
        //加载分页
        loadPageNew({
            elem: 'page_content',
            totalCount: '${page.totalCount}',
            limit: '${page.limit}',
            page: '${page.page}'
        });
        //加载日历
        layui.use(['laydate', 'element'], function () {
            var laydate = layui.laydate, element = layui.element;

            // 查询发布日期
            var start = {
                elem: 'input[name=createStart]',
                done: function(value, date, endDate){
                    $(".check-btn-inner *").removeClass("active");
                    $("[name=timeType]").val("");
                }
            };

            var end = {
                elem: 'input[name=createEnd]',
                done: function(value, date, endDate){
                    $(".check-btn-inner *").removeClass("active");
                    $("[name=timeType]").val("");
                }
            };
            laydate.render(start);
            laydate.render(end);


            element.on('tab(type)', function (data) {
                if (data.index == 0) {
                    $('#type').val(1);
                    $("[name=partnerId]").find("option:selected").val("");
                    $('#myForm').submit();
                }
                else if (data.index == 1) {
                    $('#type').val(2);
                    $("[name=partnerId]").find("option:selected").val("");
                    $('#myForm').submit();
                }
            });
        });
    })
</script>
<script type="text/javascript">
    txz.initHeader({
        nav: [{
            name: '事件分析',
            curr: true
        }],
        info: '<span class="f12">共<b id="totalCount">${page.totalCount}</b>条记录</span>'
    });
</script>
</body>
</html>